package com.hxd.otc.module.coin_deal.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hxd.otc.R;
import com.hxd.otc.api.Constant;
import com.hxd.otc.module.coin_deal.bean.CoinDealResultBean;
import com.hxd.otc.utils.StringUtil;
import com.hxd.otc.utils.UIUtils;

/**
 * 包  名 :  com.hxd.otc.module.order.adapter
 * 类  名 :  OllOrderAdapter
 * 作  者 :  zjl
 * 时  间 :  2018/6/5 18:03
 * 描  述 :  ${全部订单页面}
 */
public class CoinAdapter extends BaseQuickAdapter<CoinDealResultBean.DataBean, BaseViewHolder> {

    public CoinAdapter() {
        super(R.layout.item_coin_view, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, CoinDealResultBean.DataBean item) {

        helper.setText(R.id.name_tv, item.nickName);
        if (item.selfInd == Constant.Deal.IS_MY_COIN_DEAL) {
            helper.setText(R.id.type_tv, R.string.delete);
        } else {
            helper.setText(R.id.type_tv, R.string.order_buy);
        }
        helper.setText(R.id.tv_price, StringUtil.format8Number(item.price));
        helper.setText(R.id.number_tv, StringUtil.format4Number(item.restAmount));
        String[] splitstr = item.transPair.split("/");
        helper.setText(R.id.tv_unit_price, UIUtils.getString(R.string.unit_price, splitstr[1]));
        helper.setText(R.id.hint_number_tv, UIUtils.getString(R.string.coint_count, splitstr[0]));

    }
}
